# -*- coding: utf-8 -*- 
"""
========================================================================================================================
@project : my-sanic
@file: main
@Author: mengying
@email: 652044581@qq.com
@date: 2023/3/3 10:04
@desc: 项目主入口启动文件
========================================================================================================================
"""
import os
from sanic import Sanic
from config import config

app = Sanic(config.PROJECT_NAME)


# 引入中间件
from middleware import myMiddleware

# 引入服务监听器
from middleware import myListener

from api import api

app.blueprint(api)

if __name__ == '__main__':
    import platform
    if platform.system().lower() == 'windows':
        app.run(host='127.0.0.1', port=8000, debug=False, access_log=False, workers=1, auto_reload=True)
    else:
        app.run(host='0.0.0.0', port=8000, workers=1)
